import { createApp } from 'vue'
import { createPinia } from 'pinia'

import App from './App.vue'
import router from './router'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
import {filterRoutes} from './utils/authorization'
import routes from './router/routes'

const app = createApp(App)

app.use(createPinia())


// var permissions = JSON.parse( localStorage.getItem('userinfo') ).role.permissions;
// var accessRoutes = filterRoutes( routes , permissions )
// console.log(accessRoutes);


// accessRoutes.forEach((route)=>{
//     router.addRoute(route); 
//   })

app.use(router)
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
    app.component(key, component)
  }
  
app.mount('#app')
